import autoit
from selenium import webdriver
import time

from selenium.webdriver import ActionChains
from selenium.webdriver.common.by import By

web = webdriver.Chrome()
web.maximize_window()
web.implicitly_wait(10)
web.get("https://www.baidu.com")
dict_cookie = {"name":"BDUSS", "value":"2tJUjlKZjFoY3NuflhCZVhjbXFzR2NFWDNTWUljc0Y3a3FLb1V2ZXFuWXU2ekZoRVFBQUFBJCQAAAAAAAAAAAEAAAAlEWMJaHU2NzU1MjIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAC5eCmEuXgphS"}
web.add_cookie(dict_cookie)
web.refresh()
time.sleep(3)
web.find_element(By.CSS_SELECTOR, ".soutu-btn").click()
ele = web.find_element(By.CSS_SELECTOR, ".upload-pic")
action = ActionChains(web)
action.click(ele)
action.perform()
time.sleep(3)
autoit.win_wait_active("打开", 3)
autoit.control_send("打开", "Edit1", r"J:\头条号\sucai.png")
autoit.control_click("打开", "Button1")
time.sleep(10)
web.quit()